package com.qf.fmall2202.controller;


import com.qf.fmall2202.entity.Category;
import com.qf.fmall2202.entity.IndexImg;
import com.qf.fmall2202.entity.ProductComments;
import com.qf.fmall2202.service.ICategoryService;
import com.qf.fmall2202.service.IIndexImgService;
import com.qf.fmall2202.service.IProductCommentsService;
import com.qf.fmall2202.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 轮播图  前端控制器
 * </p>
 *
 * @author author
 * @since 2022-11-03
 */
@CrossOrigin
@RestController
@RequestMapping("/index")
public class IndexImgController {
	@Autowired
	IIndexImgService iIndexImgService;

	@Autowired
	ICategoryService iCategoryService;


	@Autowired
	IProductCommentsService iProductCommentsService;
	@RequestMapping("/indeximg")
	public R getIndexImgList( ) {
		List< IndexImg > list=iIndexImgService.list( );

		R r=new R( );

		r.setData( list );
		return r;
	}

	@RequestMapping("/category-list")
	public R getcategoryList( ) {
		List< Category > list=iCategoryService.getCategorylist( );

		R r=new R( );

		r.setData( list );
		return r;
	}

	@RequestMapping("/list-recommends")
	public R getrecommendsList( ) {
		List< ProductComments > list=iProductCommentsService.list( );

		R r=new R( );

		r.setData( list );
		return r;
	}
}
